<?php 
	class Admin_model extends CI_Model
	{
		private $table = "no_admin_user";
			
		public function update_info($username = '')
		{
			$data = array(
							'password'	        => $this->input->post('new_password'),
							'modified_time'     => getDate('Y-m-h H:i:s'),
							'ip_address'        =>  getIP()
						);
			
			$this->db->where('username',$username);
			if($this->db->update($this->table,$data)){
				return true;
			}else{
				return false;
			}
		}
		
		public function check_login($username = '',$password = '')
		{
			$this->db->select('*');
			$this->db->where('username',$username);
			$this->db->where('password',md5($password));
			$query = $this->db->get($this->table);
			
			$result = $query->result();
			$query->free_result();
			if($result)
			{
				return $result;
			}else{
				return false;
			}
		}
		
		public function admin_info($username = '')
		{
			$this->db->select('*');
			$this->db->where('username',$username);
			
			$query = $this->db->get($this->table);
			$result = $query->result();
			$query->free_result();
			if($result)
			{
				return $result;
			}else{
				return false;
			}
		}
	}
?>